"use strict";
//声明变量
//1. 布尔类型
let b = true;
let b2;
//为 b2 变量赋值
b2 = false;
// b2 = 123;
//2. 数字类型
let n = 618;
let n2;
n2 = 123;
n2 = 456;
n2 = 0b101; //2 进制
n2 = 0o777; //8 进制
n2 = 0xffea; //16 进制
console.log(n2);
//3. 字符串类型
let s = '新消息';
let s2;
s2 = 'abc'; // ""  ``
s2 = "xyz"; // ""  ``
s2 = `xyz`; // ""  ``
s = 'xxxx';
//4. 字面量
// let z: 521;
// z = 521;
// z = 123;
// z = '123'
// let z: true | false; //联合类型
// let z2: 1 | 2 | 3 | 4 | 5 | 6 | 7; //联合类型
// z = true;
// z = false;
// z2 = 1;
//5. any 任意 (尽量少用)
// let a: any;
// a = 100;
// a = false;
// a = [];
// a = {};
// a = 100;
// let a: any = 100;
// a.forEach((item:any) => {})
//6. never  了解  从不
function error() {
    throw new Error('123');
}
function test() {
    while (true) {
    }
}
//7. void 主要用来声明函数的返回值为『空』
function fn() {
    console.log('run run run');
    //函数代码体中, 直接写 return 那么该函数的返回值也是 undefined
    // return;
    //返回 undefined 也满足 void 的要求
    // return undefined;
    //不写 return 也满足 void 的要求
}
//8. object 限制值为引用类型的数据  了解
let o = { a: 100, b: 200 };
o = [1, 2, 34]; // OK
o = function () { };
//不能使用基本数据类型的值, 进行赋值
// o = 100;
// o = false;
//9. 数组 用的比较多 ts 中的数组, 每个元素的类型必须保持一致
let arr = [1, 2, 3, 4];
// arr.push(5)
// arr.push('a');
// TS 的泛型
// let arr2: Array<string> = ['a','b','c'];
//10. 元组  了解
let t = ['哈喽', 18];
let t2 = [
    ['张三', 18],
    ['别睡拉', 20]
];
//11. 枚举 了解
var Gender;
(function (Gender) {
    Gender["Female"] = "\u5973";
    Gender["Male"] = "\u7537";
    Gender["Secret"] = "\u4FDD\u5BC6";
})(Gender || (Gender = {}));
var Week;
(function (Week) {
    Week[Week["Mon"] = 0] = "Mon";
    Week[Week["Tues"] = 1] = "Tues";
    Week[Week["Wed"] = 2] = "Wed";
    Week[Week["Thur"] = 3] = "Thur";
    Week[Week["Fri"] = 4] = "Fri";
    Week[Week["Sat"] = 5] = "Sat";
    Week[Week["Sun"] = 6] = "Sun";
})(Week || (Week = {}));
let me = {
    gender: Gender.Male,
    week: Week.Mon
};
let you = {
    gender: Gender.Male
};
console.log(me);
//联合类型
// let a: string | number ;
// a = 100;
// a = 'abc';
// let div = document.querySelector('.boxx');
//类型断言
// let root = document.querySelector('#root') as HTMLElement;
// console.log(root.innerHTML);
//类型推断
// let c;
// c = 100;
// c = 'abc';
// let d = 100;
// d.slice();
